home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2.sit
/
Raven 1.2
/
Source
/
Foundation
/
Common
/
ZStringUtils.h
< prev
next >
Wrap
Text File
|
1997-08-07
|
3KB
|
86 lines
/*
* File: ZStringUtils.h
* Summary: Misc string utilities
* Written by: Jesse Jones
*
* Copyright ゥ 1996-1997 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <3> 8/05/97 JDJ Added LoadAppString and LoadRavenString.
* <2> 7/27/97 JDJ Added StripTrailing.
* <1> 8/09/96 JDJ Created (from ZMiscUtils)
*/
#pragma once
#include <String>
#include <ZConstants.h>
#include <ZTypes.h>
// ===================================================================================
// Conversions
// ===================================================================================
string PStrToStr(const unsigned char* pStr);
unsigned char* StrToPStr(const string& cStr);
const char* IDToStr(IDType id);
IDType StrToID(const string& str);
// ===================================================================================
// Loading
// ===================================================================================
string LoadString(ResID id);
string LoadIndString(ResID strList, int index);
// 1-based!
string LookUpString(ResID id, int code);
// Returns the string corresponding to code in a STRX resource (or "" if code
// isn't found). This is used by ReportError to map error codes to strings.
string LoadAppString(const string& str);
// Looks up str using 'StrM' resource 256. If the string or the resource
// is missing the input string is returned. This is the preferred way to
// use strings in Raven apps.
string LoadRavenString(const string& str);
// Like LoadAppString except that 'StrM' resource 128 is used.
// ===================================================================================
// Disassembly
// ===================================================================================
string Before(const string& str, const string& subStr);
// Returns the string before subStr or an empty string if subStr isn't found.
string After(const string& str, const string& subStr);
// Returns the string after subStr or an empty string if subStr isn't found.
string Parse(string& str, const string& term);
// Removes and returns next word in str. Word is char run not in term.
// When the last word is returned str will be empty.
// ===================================================================================
// Misc
// ===================================================================================
string StrToUpperStr(const string& lowerStr);
string StrToLowerStr(const string& upperStr);
string Strip(const string& str, const string& padding = " ");
// Removes characters in pad from the start of str.
string StripTrailing(const string& str, const string& padding = " ");
// Removes characters in pad from the end of str.
string Replace(const string& str, char oldCh, char newCh);